package com.crm.service;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class AccountService {
    @Autowired
    private RestTemplate template;

    private static final String SERVERURL = "http://crm-user/user/info";

    @HystrixCommand(fallbackMethod = "failMethod")
    public Object accountInfo(){
        return template.getForObject(SERVERURL,Object.class);
    }



    private Object failMethod(){
        return "服务失效";
    }
}
